<template>
	<view>
		<view class="ipt-wrap">

			<view class="item-wrap">
				<view class="left">
					所属测站
				</view>
				<view class="right">
					{{pagedata.stnm}}

				</view>
			</view>
			<view class="item-wrap">
				<view class="left">
					请假类型
				</view>
				<view class="right">
					<span v-show="pagedata.leaveType==1">事假</span>
					<span v-show="pagedata.leaveType==2">病假</span>
					<span v-show="pagedata.leaveType==3">婚假</span>
					<span v-show="pagedata.leaveType==4">丧假</span>
					<span v-show="pagedata.leaveType==5">年假</span>
					<span v-show="pagedata.leaveType==6">产假/陪产假</span>
					
			
				</view>
			</view>
			
			<view class="item-wrap">
				<view class="left">
					开始时间
				</view>
				<view class="right">
					{{pagedata.beginDate}}
					
								
			
				</view>
			</view>
			
			
			<view class="item-wrap">
				<view class="left">
					结束时间
				</view>
				<view class="right">
					{{pagedata.endDate}}
					
								
			
				</view>
			</view>
			<view class="item-wrap">
				<view class="left">
					请假天数
				</view>
				<view class="right">
					{{pagedata.leaveDays}}
					
				</view>
			</view>
			<view class="item-wrap">
				<view class="left">
					地点
				</view>
				<view class="right">
					{{pagedata.location}}
					
				</view>
			</view>
			<view class="item-wrap">
				<view class="left">
						出差事由
				</view>
				<view class="right">
					{{pagedata.reason}}
					
				</view>
			</view>
			
			
			
			
			<view class="item-wrap">
				<view class="left">
					备注
				</view>
				<view class="right">
					{{pagedata.remark}}
					
				</view>
			</view>
			<image v-if="pagedata.files" style="width: 634rpx; height: 358rpx;"  :src="showpic+pagedata.files" />
			
		</view>
		
		
		<view class="sub-btn">
			<image @tap="subdata(false)" style="width: 268rpx; height: 112rpx;"  src="/static/imgnew/bohui.png" />
			<image @tap="subdata(true)" style="width: 268rpx; height: 112rpx;"  src="/static/imgnew/tonggo.png" />
		</view>
	</view>
</template>


<script>
	
	export default{
		data(){
			return {
				showpic:this.$showpic,
				leaveTypeindex:0,
				arraysleaveType:['事假','病假','婚假','丧假','年假','产假/陪产假'],
				arraysname:[],
				nameindex:0,
				files:'',
				clockTypeindex:0,
				files:'',
				remark:'',
				beginDate:'',
				endDate:'',
				location:'',
				reason:'',
				user:{},
				leaveDays:'',
				stcdList:[],
				pagedata:{},
				vehicle:''
				
			}
		},
		onLoad(options){
			
			
			
			
			this.user=JSON.parse(uni.getStorageSync("userinfo"))
			
			
			
			this.stcdList=this.user.stcdList
			
			
			this.pagedata=JSON.parse(options.pagedata)
			
			this.arraysname=this.stcdList.map(item=>{
				return item.stnm
			})
		},
		onNavigationBarButtonTap(e) {
			this.subdata()
		},
		methods: {
		
			TimeChange(val,type){
				
				this[type]=val.detail.value
			},
			PickerChange(val,type){
				this[type]=val.detail.value
			},
			subdata(on){
				let that=this
				uni.showModal({
					placeholderText:'输入驳回意见',
					title: on?'确定通过？':'确定驳回？',
					editable:!on,
					content: '',
					success: function (res) {
						
						if (res.confirm) {
							
							that.apipost('/soilWater/manage/leave/edit/doApprove',{
								
								approveContent:res.content,
								approveType:'',
								approver:that.user.username,
								relatedNo: that.pagedata.id,
								status: on?1:0
							},false).then(res => {
								
								if(res.code==1){
									uni.showToast({
										icon: 'none',
										duration:4000,
										title: '操作成功'
									});
									setTimeout(function(){
										uni.navigateBack({
											delta:1
										})
									},800)
									
								}
								
							}).catch(err=>{
								console.log(err)
							});
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});
			
			},
			
			
		},

	}
</script>
<style>
	.sub-btn{
		display:flex;
		justify-content: center;
		align-items: center;
		padding:40rpx 0 0 0;
	}
	.tip-wrap{
		margin-top:30rpx;
		line-height:54rpx;
		padding-left:40rpx;
	}
	page{
		height:100%;
		background:#F5F9FF;
	}
	.ipt-wrap{
		margin-top:80rpx;
		padding:0 40rpx;
		background:#fff;
	}
	.item-wrap{
		border-bottom:1rpx solid rgba(63,140,255,0.2);;
		color:#00041A;
		height:95rpx;
		display:flex;
		align-items: center;
		justify-content: space-between;
	}
	textarea,input{
		text-align: right;
	}
</style>